package com.baitai.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baitai.common.annotation.Log;
import com.baitai.common.core.controller.BaseController;
import com.baitai.common.core.domain.AjaxResult;
import com.baitai.common.enums.BusinessType;
import com.baitai.system.domain.RecordOfWinningAPrize;
import com.baitai.system.service.IRecordOfWinningAPrizeService;
import com.baitai.common.utils.poi.ExcelUtil;
import com.baitai.common.core.page.TableDataInfo;

/**
 * recordOfWinningAPrizeController
 * 
 * @author xx
 * @date 2024-08-05
 */
@RestController
@RequestMapping("/system/recordOfWinningAPrize")
public class RecordOfWinningAPrizeController extends BaseController
{
    @Autowired
    private IRecordOfWinningAPrizeService recordOfWinningAPrizeService;

    /**
     * 查询recordOfWinningAPrize列表
     */
    @GetMapping("/list")
    public TableDataInfo list(RecordOfWinningAPrize recordOfWinningAPrize)
    {
        startPage();
        List<RecordOfWinningAPrize> list = recordOfWinningAPrizeService.selectRecordOfWinningAPrizeList(recordOfWinningAPrize);
        return getDataTable(list);
    }

    /**
     * 导出recordOfWinningAPrize列表
     */
    @Log(title = "recordOfWinningAPrize", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RecordOfWinningAPrize recordOfWinningAPrize)
    {
        List<RecordOfWinningAPrize> list = recordOfWinningAPrizeService.selectRecordOfWinningAPrizeList(recordOfWinningAPrize);
        ExcelUtil<RecordOfWinningAPrize> util = new ExcelUtil<RecordOfWinningAPrize>(RecordOfWinningAPrize.class);
        util.exportExcel(response, list, "recordOfWinningAPrize数据");
    }

    /**
     * 获取recordOfWinningAPrize详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(recordOfWinningAPrizeService.selectRecordOfWinningAPrizeById(id));
    }

    /**
     * 新增recordOfWinningAPrize
     */
    @Log(title = "recordOfWinningAPrize", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RecordOfWinningAPrize recordOfWinningAPrize)
    {
        return toAjax(recordOfWinningAPrizeService.insertRecordOfWinningAPrize(recordOfWinningAPrize));
    }

    /**
     * 修改recordOfWinningAPrize
     */
    @Log(title = "recordOfWinningAPrize", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RecordOfWinningAPrize recordOfWinningAPrize)
    {
        return toAjax(recordOfWinningAPrizeService.updateRecordOfWinningAPrize(recordOfWinningAPrize));
    }

    /**
     * 删除recordOfWinningAPrize
     */
    @Log(title = "recordOfWinningAPrize", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(recordOfWinningAPrizeService.deleteRecordOfWinningAPrizeByIds(ids));
    }

    @GetMapping("/appList")
    public AjaxResult appList(RecordOfWinningAPrize recordOfWinningAPrize)
    {
        startPage();
        List<RecordOfWinningAPrize> list = recordOfWinningAPrizeService.selectRecordOfWinningAPrizeList(recordOfWinningAPrize);
        return AjaxResult.success(getDataTable(list));
    }
}
